package com.byzk.p2p.admin.user.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.byzk.p2p.admin.base.util.PageInfo;
import com.byzk.p2p.admin.user.dao.CneeInfoDao;
import com.byzk.p2p.admin.user.dto.CneeInfo;
import com.byzk.p2p.admin.user.dto.UserAuth;

@Service
public class CneeInfoServise {

	@Autowired
	private CneeInfoDao cneeInfoDao;
	
	public List<CneeInfo> list(CneeInfo info){
		return cneeInfoDao.list(info);
	}
	
	public CneeInfo selectById(Integer id){
		return cneeInfoDao.getById(id);
	}
	
	public int saveOrUpdate(CneeInfo info){
		if(info.getId() == null){
			return cneeInfoDao.insert(info);
		}else{
			return cneeInfoDao.update(info);
		}
	}
	
	public PageInfo<CneeInfo> listCnee(CneeInfo info){
		int count=cneeInfoDao.count(info);
		List<CneeInfo> voList=cneeInfoDao.list(info);
		PageInfo<CneeInfo> page=new PageInfo<CneeInfo>(count, info.getIndex() , info.getLimit());
		page.setPageList(voList);
		return page;
	}
	
	
	/**
	 * 
	* <p>Description:删除收货地址信息 </p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2017年1月20日上午8:50:14
	 */
	public boolean cneeDelete(Integer id) {
		if (id != null) {
			Integer result = cneeInfoDao.delete(id);
			return result > 0 ? true : false;
		}
		return false;
	}
}
